# -*- encoding: utf-8 -*-
"""

PyCharm 20柱状图的绘制应用.py
2024年 10月 28日 14:17
coded by wenyang
文件的主要内容


"""
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np


def main():
    mpl.rcParams["font.sans-serif"] = ["SimHei"]
    mpl.rcParams["axes.unicode_minus"] = False
    # 产生数据
    y = np.array([10, 20])
    x = np.arange(y.size)
    plt.xlabel("性别")
    plt.ylabel("人数")
    plt.title("男生女生的人数显示")
    plt.bar(x, y, color = "red", align = "center", alpha = 0.6, edgecolor = "blue", tick_label = ["男生", "女生"], label = "性别人数柱状图", hatch = "x")
    plt.legend(loc = "best")
    plt.show()


if __name__ == "__main__":
    main()
